﻿@Html.DevExpress().GridView(
            settings =>
            {
                settings.Name = "gvEditing";
                settings.KeyFieldName = "FApplicationFormID";
                settings.CallbackRouteValues = new { Controller = "AllowanceApplicationFormFront", Action = "AllowanceApplicationFormFrontListPartial" };
                settings.Width =System.Web.UI.WebControls.Unit.Percentage(100);

                settings.Columns.Add(column =>
                {
                    column.Caption = "操作";

                    column.SetDataItemTemplateContent(c =>
                    {
                        if (DataBinder.Eval(c.DataItem, "FStatus").ToString() == "-1")
                        {
                            Html.DevExpress().HyperLink(s => { s.Name = "linkDel" + c.VisibleIndex; s.Properties.Text = "预受理"; s.ToolTip = "预受理"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_Edit.png"); s.Properties.ClientSideEvents.Click = "function(){AllowanceApplicationFormFront('" + DataBinder.Eval(c.DataItem, "NSRDZDAH") + "','" + DataBinder.Eval(c.DataItem, "FFileNo") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                        }
                        else if (DataBinder.Eval(c.DataItem, "FStatus").ToString() == "0")
                        {
                            Html.DevExpress().HyperLink(s => { s.Name = "linkDel" + c.VisibleIndex; s.Properties.Text = "删除"; s.ToolTip = "删除"; s.Properties.ImageUrl = Url.Content("~/Content/ControlImages/button_delete.png"); s.Properties.ClientSideEvents.Click = "function(){AllowanceApplicationFormFrontDel('" + DataBinder.Eval(c.DataItem, "FApplicationFormID") + "')}"; s.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); }).GetHtml();
                        }
                    });
                    column.Settings.AllowDragDrop = DefaultBoolean.False;
                    column.Settings.AllowSort = DefaultBoolean.False;
                    
                    column.Width = 70;
                });


                settings.Columns.Add("NSRMC", "纳税人名称");
                settings.Columns.Add("NSRBM", "纳税人编码");
                settings.Columns.Add("FFileNo", "文号");
                settings.Columns.Add(co =>
                {
                    co.PropertiesEdit.DisplayFormatString = "n2";
                    co.FieldName = "FAmount";
                    co.Caption = "补贴金额";
                    co.CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
                });
                settings.Columns.Add("FFinancePropShortName", "经济类型");
               // settings.Columns.Add("FAuditAmount", "财政核定金额").CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Right;
                settings.SettingsBehavior.AllowSort = false;
                settings.SettingsBehavior.AllowDragDrop = false;
                settings.SettingsBehavior.AllowSelectByRowClick = false;
                settings.SettingsLoadingPanel.Text = "数据读取中...";
                settings.SettingsBehavior.AllowClientEventsOnLoad = false;
                settings.SettingsBehavior.AllowFocusedRow = true;

                settings.TotalSummary.Add(DevExpress.Data.SummaryItemType.Sum, "FAuditAmount").DisplayFormat = "{0}";
                settings.TotalSummary.Add(DevExpress.Data.SummaryItemType.Count, "NSRMC").DisplayFormat = "合计:共{0}行";
                settings.ClientSideEvents.BeginCallback = "function(s,e){OnBeginCallback(s,e)}";
                
                settings.CommandColumn.Visible = false;
                settings.CommandColumn.Width = System.Web.UI.WebControls.Unit.Pixel(5);

                settings.SettingsPager.Position = System.Web.UI.WebControls.PagerPosition.Bottom;
                settings.SettingsPager.FirstPageButton.Visible = true;
                settings.SettingsPager.LastPageButton.Visible = true;
                settings.SettingsPager.PageSize = EnterpriseFund.Common.GlobalConstant.CONSTRING_PAGESIZE;
                settings.SettingsPager.AlwaysShowPager = true;
                settings.Settings.ShowFooter = true;
                settings.PageIndexChanged = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    grid.Selection.UnselectAll();
                };
                settings.DataBinding = (sender, e) =>
                {
                    ASPxGridView grid = (ASPxGridView)sender;
                    for (int i = 0; i < grid.AllColumns.Count; i++)
                    {
                        if (grid.AllColumns[i].CellStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].CellStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                        if (grid.AllColumns[i].HeaderStyle.HorizontalAlign == System.Web.UI.WebControls.HorizontalAlign.NotSet)
                        {
                            grid.AllColumns[i].HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Center;
                        }
                    }
                };            
                
                
            }).Bind(Model).GetHtml()